/**
 * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
 * 
 * Published under the BSD license.
 * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
 * of the license.
 */

/** api: example[tree]
 *  Tree Nodes
 *  ----------
 *  Create all kinds of tree nodes.
 */

var mapPanel;
Ext.onReady(function() {
    // create a map panel with some layers that we will show in our layer tree
    // below.
    mapPanel = new GeoExt.MapPanel({
        border: true,
        region: "center",
        // we do not want all overlays, to try the OverlayLayerContainer
        map: getMap()
    });

 
    
    new Ext.Viewport({
        layout: "fit",
        hideBorders: true,
        items: {
            layout: "border",
            deferredRender: false,
            items: [mapPanel]
        }
    });
	var map = mapPanel.map;
	map.addControls(getControls());
//	var myStyles = new OpenLayers.StyleMap({
//                "default": new OpenLayers.Style({
//                    pointRadius: 5, // sized according to type attribute
//                    fillColor: "#ffcc66",
//					fillOpacity: 0.5,
//                    strokeColor: "#ff9933",
//                    strokeWidth: 2,
//					strokeLinecap: 'square',
//                    graphicZIndex: 1
//                }),
//                "select": new OpenLayers.Style({
//                    fillColor: "#66ccff",
//                    strokeColor: "#3399ff",
//                    graphicZIndex: 2
//                })
//            });
	var vectors = new OpenLayers.Layer.Vector("Vector Layer"
//	,  {
//                styleMap: myStyles,
//                rendererOptions: {zIndexing: true}
//            }
			);
	map.addLayer(vectors);
	var click = new OpenLayers.Control.Click({vectorLayer: vectors});
	map.addControl(click);
	click.activate();
	var selectCtrl = getPopUp(vectors, click);
	map.addControl(selectCtrl);
	selectCtrl.activate();
	map.zoomToExtent(new OpenLayers.Bounds(-9236957.386267668, 4858533.863157441, -9233729.12103511, 4859550.377303473));
});
